package com.ylr.blog.framework.controller.web;

import java.util.Map;

import com.ylr.base.common.tool.Result;
import com.ylr.blog.common.vo.browse_blog.BrowseBlogVo;
import com.ylr.blog.framework.service.BrowseBlogService;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import com.ylr.blog.framework.entity.BrowseBlogEntity;


/**
 * Created by IntelliJ IDEA.
 *
 * @author wyw
 * date: 2023-05-25 23:11:11
 * className: BrowseBlogWebController
 * version: 1.0
 * description:
 */
@Validated
@RestController
@RequestMapping("/web/browse-blog")
@AllArgsConstructor
public class BrowseBlogWebController {

    private static final Logger log = LoggerFactory.getLogger(BrowseBlogWebController.class);

    private final BrowseBlogService browseBlogService;

    /**
     * 保存博客浏览记录接口
     * @param browseBlogVo 参数对象
     */
    @PostMapping("/save")
    public Result<Object> saveBrowseBlog(@Validated @RequestBody BrowseBlogVo browseBlogVo) {
        log.info("web => 开始保存博客浏览记录操作。{}", browseBlogVo);

        browseBlogService.saveBrowseBlog(browseBlogVo);

        log.info("web => 保存博客浏览记录操作结束");
        return Result.success();
    }

    /**
     * 列表
     */
    @GetMapping("/page/list")
    public Result<Object> pageBrowseBlogList(@RequestParam Map<String, Object> params) {
//        PageUtils page = browseBlogService.queryPage(params);

        return Result.success();
    }


    /**
     * 信息
     */
    @GetMapping("/get")
    public Result<Object> getBrowseBlog(@RequestParam("id") Long id) {
//		BrowseBlogEntity browseBlog = browseBlogService.getById(id);

        return Result.success();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    public Result<Object> updateBrowseBlog(@RequestBody BrowseBlogEntity browseBlog) {
//		browseBlogService.updateById(browseBlog);

        return Result.success();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
    public Result<Object> deleteBrowseBlog(@RequestBody Long[] ids) {
//		browseBlogService.removeByIds(Arrays.asList(ids));

        return Result.success();
    }

}
